#
# @lc app=leetcode.cn id=989 lang=python3
#
# [989] 数组形式的整数加法
#
from typing import List
# @lc code=start
class Solution:
    def addToArrayForm(self, num: List[int], k: int) -> List[int]:
        n = int("".join([str(d) for d in num])) + k
        ans = []
        if n == 0:
            ans.append(0)
            return ans
        while n != 0:
            ans.append(n % 10)
            n //= 10
        return ans[::-1]
# @lc code=end

